package com.zhuoyue.web.factory;

import com.zhuoyue.biz.core.command.Device;

/**
 * @author Administrator
 */
public class DeviceFactory {

	public static <T> T getClass(Class<? extends T> clazz) {
		T obj = null;

		try {
			obj = (T) Class.forName(clazz.getName()).newInstance();
		} catch (InstantiationException e) {
			e.printStackTrace();
		} catch (IllegalAccessException e) {
			e.printStackTrace();
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		}

		return obj;

	}

	public static Device getClass(String className) {
		Device obj = null;
		System.out.println("---getClass---" + className);
		try {
			obj = (Device) Class.forName(className).newInstance();
		} catch (InstantiationException e) {
			e.printStackTrace();
		} catch (IllegalAccessException e) {
			e.printStackTrace();
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		}
		return obj;
	}

}
